import O1HD, { services } from "../../engines/gameEngine";
import SystemBase from "../Base/SystemBase";
import { GAME_EVENT, INPUT_TYPE } from "../Enum";
import mainRoot from "../MainRoot";

export default class InputSystem extends SystemBase{
    systemName: string = "输入系统";

    private m_inputSwitch : boolean = true;
    public set enableInput(value:boolean){
        this.m_inputSwitch = value;
        // console.log("修改了输入开关",value);
    }
    public get enableInput(){
        return this.m_inputSwitch;
    }
    private readonly inputTypeSave : string = 'input_inputTypeSave';
    private m_inputType : INPUT_TYPE = INPUT_TYPE.RIGHT;
    public get InputType(){
        return this.m_inputType;
    }
    public set InputType(value){
        this.m_inputType = value;
        this.Log("设置为",value);
        services().localStorageSrv.setStorage(this.inputTypeSave,this.m_inputType);
    }

    public SystemInit(){
        super.SystemInit();
        let type = services().localStorageSrv.getStorage(this.inputTypeSave);
        if(type){
            this.m_inputType = Number(type);
        }
        this.Log("初始化完成");
    }

    public async OnDirLongDown(dir:cc.Vec2){

    }
}